<link href='../../insumos/Scripts/styles.css' rel='stylesheet' type='text/css' />
<?php include("../insumos/paginacion/incluir.php");?>
<body onload='$("table").eq(0).tableFilter();'>
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="0" class="texto">
<tr class="header" background="/insumos/img/fondo1.jpg">
		<td height="30" colspan="6" background="/insumos/img/fondo1.jpg"><div align="center"><strong>Pedidos Pendientes</strong></div>		  <div align="center"></div>		  <div align="center"></div>		  <div align="center"></div>		  <div align="center"></div>		  <div align="center"></div></td>
    </tr>
	
	

	<tr class="header" background="/insumos/img/fondo1.jpg">
		<td background="/insumos/img/fondo1.jpg"> <div align="center"><strong><? echo "C&oacute;digo" ?></strong></div></td>
		<td background="/insumos/img/fondo1.jpg"><div align="center"><strong> Fecha </strong></div></td>
		<td background="/insumos/img/fondo1.jpg"> <div align="center"><strong><? echo "Cliente" ?></strong> </div></td>
		<td background="/insumos/img/fondo1.jpg"><div align="center"><strong> Importe </strong></div></td>
		<td background="/insumos/img/fondo1.jpg"><div align="center"><strong> Precio Unitario </strong></div></td>
		<td background="/insumos/img/fondo1.jpg"><div align="center"><strong> Sub-Total </strong></div></td>
	</tr>
<?$total=0;
foreach($Detallefactura->find("id_de_venta= $id_venta") as $detalle)
 
{?>
	<tr>
	  <td>&nbsp;</td>
	  <td>&nbsp;</td>
	  <td>&nbsp;</td>
	  <td>&nbsp;</td>
	  <td>&nbsp;</td>
	  <td></td>
  </tr>
	<tr>
		<td> <div align="center"><? echo $detalle->producto_id; ?></div></td>
		<td> <div align="center"><? echo $detalle->nombre ?> </div></td>
		<td><div align="center"><? echo $detalle->cantidad; ?></div></td>
		<td> <div align="center"><? echo money($detalle->precio_venta); ?> </div></td>
		<td><div align="center"><? echo money($detalle->cantidad*$detalle->precio_venta); ?> </div></td>
		<td><div align="center"></div></td>
	</tr>
	
	<?$total=$total+($detalle->cantidad*$detalle->precio_venta);
	
}?>
	<tr>
	  <td></td>
	  <td></td>
	  <td></td>
	  <td>&nbsp;</td>
	  <td>&nbsp;</td>
      <td>&nbsp;</td>
  </tr>
	<tr>
	
		<td>		</td>
		<td>		</td>
		<td>		</td>
		<td><div align="right"><strong>Total:</strong></div></td>
		<td>
		  <div align="center">
		    <?
		echo money($total);
		?>		
        </div></td>
        <td>&nbsp;</td>
	</tr>
	</table>
	<? foreach($Venta->find("id= $id_venta") as $venta)
{
	$venta->cliente_id=$cliente_id;
	$venta->importe=$total;
	$venta->update_all("importe=$total","conditions: id = $id_venta");//Lo hice de esta manera por 
	//que de la otra no actualizaba, no se porque
	//$venta->update();
	echo $venta->importe;
	
}?>
</body>